package z.explorer.core.storage.dao.impl;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import z.explorer.core.storage.Storage;
import z.explorer.core.storage.dao.StorageDAO;

public class StorageDAOImpl extends SqlMapClientDaoSupport implements
		StorageDAO {

	@Override
	public List<Storage> getDistributionByDay(Date yyyymmdd) {
		// TODO Auto-generated method stub
		HashMap<String, Object> hashMap = new HashMap<String, Object>();
		SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
		hashMap.put("yyyymmdd", format.format(yyyymmdd));
		return (List<Storage>)getSqlMapClientTemplate().queryForList("selectStorageByDay", hashMap);
	}

	@Override
	public List<Storage> getDistributionByOwner(String owner) {
		// TODO Auto-generated method stub
		HashMap<String, Object> hashMap = new HashMap<String, Object>();
		
		hashMap.put("owner",owner);
		return (List<Storage>)getSqlMapClientTemplate().queryForList("selectStorageByOwner", hashMap);
	}

	@Override
	public List<Storage> getDistribution() {
		// TODO Auto-generated method stub
		return (List<Storage>)getSqlMapClientTemplate().queryForList("selectStorage");
	}

}
